"""添加日志页面"""
from selenium.webdriver.common.by import By
from page.base_page import BasePage
class AddLogPage(BasePage):
    """数据准备"""
    url = "/index.php?m=log&a=mylog_add"
    #定位器
    click_title_locator = (By.NAME, "subject")
    click_description_locator = (By.CSS_SELECTOR, "body")
    click_save_locator = (By.CSS_SELECTOR,"body > div.container > div.row > div > form > table > tfoot > tr > td:nth-child(2) > input:nth-child(1)")
    def title(self,content):
        """编辑标题"""
        self.find_element(self.click_title_locator).clear()
        self.send_keys(self.click_title_locator,content)
    def description(self,content):
        """编辑内容"""
        self.driver.switch_to.frame(0)
        self.send_keys(self.click_description_locator,content)
        self.driver.switch_to.parent_frame()
    def click_save(self):
        """点击保存"""
        self.click(self.click_save_locator)

